From 1a2d9c368ee073e4d0bb678f32e81e3e4bb3aa8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Jard=C3=B3n?= Date: Wed, 15 Dec 2010 23:55:59 +0000 Subject: [PATCH] gtk/gtkcolorsel.c: Use accessor functions to access GtkSelectionData --- gtk/gtkcolorsel.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 2ed64827af..d0debfca3c 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -808,6 +808,7 @@ color_sample_drop_handle (GtkWidget *widget, { GtkColorSelection *colorsel = data; GtkColorSelectionPrivate *priv; + gint length; guint16 *vals; gdouble color[4]; priv = colorsel->private_data; @@ -818,21 +819,23 @@ color_sample_drop_handle (GtkWidget *widget, * B * opacity */ - - if (selection_data->length < 0) + + length = gtk_selection_data_get_length (selection_data); + + if (length < 0) return; /* We accept drops with the wrong format, since the KDE color * chooser incorrectly drops application/x-color with format 8. */ - if (selection_data->length != 8) + if (length != 8) { g_warning ("Received invalid color data\n"); return; } - - vals = (guint16 *)selection_data->data; - + + vals = (guint16 *) gtk_selection_data_get_data (selection_data); + if (widget == priv->cur_sample) { color[0] = (gdouble)vals[0] / 0xffff; @@ -1533,23 +1536,26 @@ palette_drop_handle (GtkWidget *widget, gpointer data) { GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data); + gint length; guint16 *vals; gdouble color[4]; - - if (selection_data->length < 0) + + length = gtk_selection_data_get_length (selection_data); + + if (length < 0) return; /* We accept drops with the wrong format, since the KDE color * chooser incorrectly drops application/x-color with format 8. */ - if (selection_data->length != 8) + if (length != 8) { g_warning ("Received invalid color data\n"); return; } - - vals = (guint16 *)selection_data->data; - + + vals = (guint16 *) gtk_selection_data_get_data (selection_data); + color[0] = (gdouble)vals[0] / 0xffff; color[1] = (gdouble)vals[1] / 0xffff; color[2] = (gdouble)vals[2] / 0xffff; -- 2.30.2